﻿using NFine.Code;
using NFine.Web.App_Start._02_Class;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WeiXin.SDK.Helpers;

namespace NFine.Web.App_Start
{
    public class WeixinConfig
    {
        public static string Token { private set; get; }
        public static string EncodingAESKey { private set; get; }
        public static string AppID { private set; get; }
        public static string AppSecret { private set; get; }
        public static string PartnerKey { private set; get; }
        public static string mch_id { private set; get; }
        public static string device_info { private set; get; }
        public static string spbill_create_ip { private set; get; }
        public static string OauthScope { private set; get; }

        public static string Domain { private set; get; }

        public static TokenHelper TokenHelper { private set; get; }

        public static void Register()
        {

            Token = Configs.GetValue("wxToken");
            EncodingAESKey = Configs.GetValue("wxEncodingAesKey");
            AppID = Configs.GetValue("wxAppId");
            AppSecret = Configs.GetValue("wxAppSecret");
            PartnerKey = Configs.GetValue("PartnerKey");
            mch_id = Configs.GetValue("mch_id");
            device_info = Configs.GetValue("device_info");
            spbill_create_ip = Configs.GetValue("spbill_create_ip");
            var openJSSDK = int.Parse(Configs.GetValue("OpenJSSDK")) > 0;
            OauthScope = Configs.GetValue("OauthScope");
            TokenHelper = new TokenHelper(6000, AppID, AppSecret, openJSSDK);
            Domain = Configs.GetValue("Domain");
            TokenHelper.Run();

            TimerTask timers = new TimerTask();
            timers.Run();
        }

        public static string yuedl = "http://www.yuedl.com:7000/";
    }
}